import { BrowserRouter, Routes, Route, useRoutes } from "react-router-dom";
import { lazy } from 'react'

// import Layout from '../pages/layout/Layout.jsx'
// import Home from '../pages/home/Home.jsx'
// import NotFound from '../pages/404/index.jsx'

const Layout = lazy(() => import('../pages/layout/Layout.jsx'))
const Home = lazy(() => import('../pages/home/Home.jsx'))
const NotFound = lazy(() => import('../pages/404/index.jsx'))

const routesList = [
    {
        path: '/',
        element: <Layout></Layout>,
        children: [
            {
                path: '',
                element: <Home></Home>,
            },
            {
                path: '/home',
                element: <Home></Home>,
            }
        ]
    },
    {
        path: '*',
        element: <NotFound></NotFound>,
    }
]

function WrapperRoutes() {
    let element = useRoutes(routesList) // <Route path='' element={}></Route>
    return element
}

export default WrapperRoutes;